import './index.css';

export default {
  name: 'jsx',
  props: {
    title: {
      type: String,
      default: 'title',
    },
  },
  data() {
    return {
      loading: true,
      isShow: true,
    };
  },

  created() {
    setTimeout(() => {
      this.loading = false;
    }, 2000);
  },
  methods: {
    async handleClick() {
      const data = await this.$api.account.user.getUserList();
      if (!this.loading) {
        console.log('lcick', data);
      }
    },
  },

  render() {
    const { loading, handleClick, title, isShow } = this;
    const list = [0, 1, 2].map(item => {
      return <div>{item}</div>;
    });

    if (!isShow) {
      return;
    }

    return (
      <div>
        {title}
        {list}
        <el-button class="btn" type="primary" loading={loading} onClick={handleClick}>
          确定
        </el-button>
      </div>
    );
  },
};
